package org.uturn.timeshift.web.menus.utils;

import org.uturn.timeshift.utils.utils.XMLModel;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Iterator;
import java.util.List;

/**
 * Created by przemyslaw.sudak on 2/27/2015.
 */
@XmlRootElement(name = "menu")
public class MenuModel extends XMLModel {

    @XmlElement(name = "item")
    List<ItemMenuModel> items;

    public List<ItemMenuModel> getMenu() {
        return items;
    }

    public void setMenu(List<ItemMenuModel> items) {
        this.items = items;
    }

    public String toString(){
        StringBuilder sb = new StringBuilder();

        for(Iterator<ItemMenuModel> i = items.iterator(); i.hasNext();){
            sb.append(i.next().toString());
            sb.append(" | \n");
        }

        return sb.toString();
    }
}
